<template>
    <div class="login_container">
        <div class="login_button" @click="onLogin">点击登录</div>
        <div class="login_button" @click="onDelete">取消登录</div>
    </div>
</template>

<script>
export default {
    methods:{
        onLogin(){
            console.log(this.$router)
            window.setTimeout(()=>{
                localStorage.setItem('login',JSON.stringify(true))
                this.$router.push(this.$route.params.to.name)
            },2000); 
        },
        onDelete(){
            localStorage.setItem('login',JSON.stringify(false))
        }
    }
}
</script>

<style scoped>
    .login_container {
        width: 100%;
    }
    .login_button {
        width: 80%;
        height: 50px;
        margin-left: 10%;
        border-radius: 10px;
        background-color: skyblue;
        color: #fff;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        margin-top: 50px;
    }
</style>